#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
extern signed char A;
extern signed short B;
extern signed int C;
extern signed long long D;
extern unsigned char E;
extern unsigned short F;
extern unsigned int G;
extern unsigned long long H;
extern bool I;
extern unsigned char J;
extern unsigned short K;
extern unsigned int L;
extern unsigned long long M;
extern float N;
extern double O;
extern char P[255];
extern char Q[255];
extern char R;
extern wchar_t S;
extern int T;
extern int V;
typedef struct{
	char name[255];
	signed short age;
	signed int tt;
}_StructOfStudent;
extern _StructOfStudent StructOfStudent;
extern int Y[2];
extern bool Z[2];
extern int ty_date;
extern int ty_tod;
extern int ty_time;
extern void* pp;
extern int getValue(char* name, char* type, void* value)
{
	if(strcmp(name,"A") == 0 && strcmp(type,"SINT")==0){
		*(signed char*)value = A;
		return 1;
	}
	if(strcmp(name,"B") == 0 && strcmp(type,"INT")==0){
		*(signed short*)value = B;
		return 1;
	}
	if(strcmp(name,"C") == 0 && strcmp(type,"DINT")==0){
		*(signed int*)value = C;
		return 1;
	}
	if(strcmp(name,"D") == 0 && strcmp(type,"LINT")==0){
		*(signed long long*)value = D;
		return 1;
	}
	if(strcmp(name,"E") == 0 && strcmp(type,"USINT")==0){
		*(unsigned char*)value = E;
		return 1;
	}
	if(strcmp(name,"F") == 0 && strcmp(type,"UINT")==0){
		*(unsigned short*)value = F;
		return 1;
	}
	if(strcmp(name,"G") == 0 && strcmp(type,"UDINT")==0){
		*(unsigned int*)value = G;
		return 1;
	}
	if(strcmp(name,"H") == 0 && strcmp(type,"ULINT")==0){
		*(unsigned long long*)value = H;
		return 1;
	}
	if(strcmp(name,"I") == 0 && strcmp(type,"BOOL")==0){
		*(bool*)value = I;
		return 1;
	}
	if(strcmp(name,"J") == 0 && strcmp(type,"BYTE")==0){
		*(unsigned char*)value = J;
		return 1;
	}
	if(strcmp(name,"K") == 0 && strcmp(type,"WORD")==0){
		*(unsigned short*)value = K;
		return 1;
	}
	if(strcmp(name,"L") == 0 && strcmp(type,"DWORD")==0){
		*(unsigned int*)value = L;
		return 1;
	}
	if(strcmp(name,"M") == 0 && strcmp(type,"LWORD")==0){
		*(unsigned long long*)value = M;
		return 1;
	}
	if(strcmp(name,"N") == 0 && strcmp(type,"REAL")==0){
		*(float*)value = N;
		return 1;
	}
	if(strcmp(name,"O") == 0 && strcmp(type,"LREAL")==0){
		*(double*)value = O;
		return 1;
	}
	if(strcmp(name,"P") == 0 && strcmp(type,"STRING")==0){
		sprintf((char*)value,"%s",(char*)P);
		return 1;
	}
	if(strcmp(name,"Q") == 0 && strcmp(type,"WSTRING")==0){
		swprintf((wchar_t*)value,255,L"%s",(wchar_t*)Q);
		return 1;
	}
	if(strcmp(name,"R") == 0 && strcmp(type,"CHAR")==0){
		*(char*)value = R;
		return 1;
	}
	if(strcmp(name,"S") == 0 && strcmp(type,"WCHAR")==0){
		*(wchar_t*)value = S;
		return 1;
	}
	if(strcmp(name,"T") == 0 && strcmp(type,"TIME")==0){
		*(int*)value = T;
		return 1;
	}
	if(strcmp(name,"V") == 0 && strcmp(type,"DATE_AND_TIME")==0){
		*(int*)value = V;
		return 1;
	}
	if(strcmp(name,"StructOfStudent") == 0 && strcmp(type,"STRUCT")==0){
		memcpy(value,&StructOfStudent,261); 
		return 1;
	};
	if(strcmp(name,"Y") == 0 && strcmp(type,"Array_INT")==0){
		memcpy(value,Y,sizeof(int)*2); 
		return 1;
	};
	if(strcmp(name,"Z") == 0 && strcmp(type,"Array_BOOL")==0){
		memcpy(value,Z,sizeof(int)*2); 
		return 1;
	};
	if(strcmp(name,"ty_date") == 0 && strcmp(type,"DATE")==0){
		*(int*)value = ty_date;
		return 1;
	}
	if(strcmp(name,"ty_tod") == 0 && strcmp(type,"TIME_OF_DAY")==0){
		*(int*)value = ty_tod;
		return 1;
	}
	if(strcmp(name,"ty_time") == 0 && strcmp(type,"TIME")==0){
		*(int*)value = ty_time;
		return 1;
	}
	if(strcmp(name,"pp") == 0 && strcmp(type,"POINTER")==0){
		*(void**)value = pp;
		return 1;
	}
	printf("Symbol not found!!");
	return 0;
}
